﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Demo5
{
    /// <summary>
    /// 黑客帝国的特效
    /// </summary>
    internal class Program
    {
        static void Main(string[] args)
        {
            //设置屏幕
            Console.Title = "黑客的效果";
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WindowHeight = Console.LargestWindowHeight - 10;
            Console.WindowWidth = Console.LargestWindowWidth;

            //用于生成随机数
            var random = new Random();

            //用循环输出字符
            for(; ; )
            {
                //设置控制台光标的位置在第（0，0）像素的位置
                Console.SetCursorPosition(0, 0);
                //嵌套的循环
                for (int m=0;m<Console.WindowHeight-10 ;m++ )
                {
                    //Console.WindowWidth 控制台窗口的宽度，随机打印出字符
                    for (int n = 0; n < Console.WindowWidth; n++)
                    {
                        //用随机的ASCII码生成一个字符
                        char ch = (char)random.Next(33, 126);
                        Console.Write(ch);
                    }
                    Console.WriteLine("\n");
                    // 速度
                    //Thread.Sleep(1000);
                }
            }
        }
    }
}
